from sqlalchemy.orm import relationship

from app.modes.base import db,Base
from sqlalchemy import Column, Integer, String,Boolean,Float,ForeignKey

class Wish(Base): #礼物表
    id=Column(Integer,primary_key=True)
    user=relationship('User')  #关联user表
    uid=Column(Integer,ForeignKey('user.id')) #设置关联字段，数据库外键
    isbn = Column(String(15), nullable=False, unique=True) #isbn 唯一且不为空，可以让2个表直接关联
    # book = relationship('Book')
    # bid = Column(Integer, ForeignKey('book.id'))
    launched=Column(Boolean,default=False) #字段表示礼物（书籍）是否送出去